<!DOCTYPE html>
<html>
<head>
    <title>积分商品表</title>
		<#include "/header.html">
</head>
<body>
<div id="rrapp" v-cloak>
    <div v-show="showList">
        <div class="grid-btn">
            <form class="form-inline" role="form">
                &nbsp;&nbsp;
                <a @click="reset"><i class="fa fa-refresh"></i></a>
                <div class="form-group">
                    <input type="text" class="form-control" v-model="q.pointName" @keyup.enter="query" placeholder="积分商品名">
                </div>
                &nbsp;&nbsp;
                <a class="btn btn-primary "  @click="query"><i class="fa fa-search"></i>&nbsp;查询</a>
                <#if shiro.hasPermission("configPointSku:configpointsku:save")>
                    <a class="btn btn-primary btn-sm" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</a>
                </#if>
                <#if shiro.hasPermission("configPointSku:configpointsku:update")>
                    <a class="btn btn-primary btn-sm" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</a>
                </#if>
                <#if shiro.hasPermission("configPointSku:configpointsku:delete")>
                    <a class="btn btn-primary btn-sm" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</a>
                </#if>
            </form>
        </div>
        <table id="jqGrid"></table>
        <div id="jqGridPager"></div>
    </div>

    <div v-show="!showList" class="panel panel-default col-sm-4">
        <div class="panel-heading">{{title}}</div>
        <form class="form-horizontal">
            <!--<div class="form-group">-->
                <!--<div class="col-sm-2 control-label">商品三级分类:</div>-->
                <!--<div class="col-sm-4">-->
                    <!--<el-button type="info" plain @click="choiceCategory()">-->
                        <!--请选择三级分类-->
                    <!--</el-button>-->
                <!--</div>-->
            <!--</div>-->
			 <div class="form-group">
                <div class="col-sm-2 control-label">商品sku,产品id</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control input-sm" v-model="configPointSku.sku" placeholder="请点击左侧选择sku"/>
                </div>
             </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">sku规格属性</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control input-sm" v-model="configPointSku.attributes" placeholder="兑换商品所需积分"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">兑换商品所需积分</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control input-sm" v-model="configPointSku.needPoints" placeholder="兑换商品所需积分"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">优惠券兑换数量</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control input-sm" v-model="configPointSku.exchangeNum" placeholder="优惠券兑换数量"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">间隔天数</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control input-sm" v-model="configPointSku.intervalTime" placeholder="间隔天数"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">上下架状态</div>
                <div class="col-sm-10">
                    <!--<input type="text" class="form-control input-sm" v-model="configPointSku.marketable" placeholder="是否上架:0-下架 1-上架"/>-->
                    <el-switch style="display: block" v-model="configPointSku.marketable"
                               active-color="#cbd8e6" inactive-color="##409EFF"
                               active-text="上架" inactive-text="下架">
                    </el-switch>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">开始时间</div>
                <div class="col-sm-10">
                    <!--<input type="text" class="form-control input-sm" v-model="configPointSku.startTime" placeholder="开始时间"/>-->
                    <div class="block">
                        <el-date-picker
                                v-model="configPointSku.startTime"
                                type="date"
                                placeholder="开始时间"
                                format="yyyy 年 MM 月 dd 日"
                                value-format="yyyy-MM-dd HH:hh:mm">
                        </el-date-picker>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">结束时间</div>
                <div class="col-sm-10">
                    <!--<input type="text" class="form-control input-sm" v-model="configPointSku.endTime" placeholder="结束时间"/>-->
                    <div class="block">
                        <el-date-picker
                                v-model="configPointSku.endTime"
                                type="date"
                                @change="choiceTime"
                                placeholder="结束时间"
                                format="yyyy 年 MM 月 dd 日"
                                value-format="yyyy-MM-dd HH:hh:mm">
                        </el-date-picker>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">备注</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control input-sm" v-model="configPointSku.remark" placeholder="备注"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">排序</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control input-sm" v-model="configPointSku.pOrder" placeholder="排序"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label"></div>
                <input type="button" class="btn btn-primary  btn-sm" @click="saveOrUpdate" value="确定"/>&nbsp;&nbsp;
                <input type="button" class="btn btn-warning  btn-sm" @click="reload" value="返回"/>
            </div>
        </form>
    </div>
    <div class="col-sm-8" v-show="!showList"  v-if="title == '新增'">
        <div class="col-sm-5" height="100%">
            <div class="grid-btn">
                <form class="form-inline" role="form">
                    <el-button type="info" plain @click="choiceCategory()">
                        请选择三级分类
                    </el-button>
                    <div class="form-group">
                        <input type="text" class="form-control a input-sm" width="30px" v-model="spuQuery.goodsId" placeholder="商品Id">
                    </div>
                    <div class="form-group">
                        <input type="text" class="form-control input-sm" v-model="spuQuery.name" placeholder="查询商品名">
                    </div>
                    <a class="btn btn-primary btn-sm" @click="loadSpuData"><i class="fa fa-search"></i>&nbsp;查询</a>
                    <div class="panel-heading">(*温馨提示:双击选择商品加载sku数据表格)</div>
                </form>
            </div>
            <template v-if="spuTableData != null">
                <el-table :data="spuTableData" width="90%" stripe @cell-dblclick="choiceSpu" style="width: 100%">
                    <el-table-column prop="goodsId" label="商品id" width="180"></el-table-column>
                    <el-table-column prop="name" label="商品名" ></el-table-column>
                </el-table>
            </template>
            <template v-else>
                <span class="panel-heading">数据待加载...</span>
            </template>
        </div>
        <div class="col-sm-7" style="border-left:1px solid #000">
            <template v-if="skuTableData != null" height="100%">
                <div class="panel-heading">(*温馨提示:下列表格是选中商品的sku列表,双击即可添加至正在新建的活动商品中)</div>
                <el-table :data="skuTableData" width="90%" stripe @row-dblclick="choiceSku" style="width: 100%">
                    <el-table-column prop="productId" label="产品id" width="180"></el-table-column>
                    <el-table-column prop="totalPrice" label="产品价格" width="180"></el-table-column>
                    <el-table-column prop="optionNames" label="产品规格选项" width="180"></el-table-column>
                </el-table>
            </template>
        </div>
    </div>
    <!-- 商品三级分类选择 -->
    <el-dialog title="选择" :visible.sync="goodsCategoryDialogVisible" width="40%">
        <div class="el-form-item">
            <label class="el-form-item__label" style="width: 80px;">商品分类</label>
            <div class="el-form-item__content" style="margin-left: 80px;">
                <el-cascader style="width: 90%"
                             v-model="categoryId"
                             :options="categoryTree"
                             @change="categoryChange">
                </el-cascader>
            </div>
        </div>
        </span>
    </el-dialog>
</div>

<script src="${request.contextPath}/statics/js/modules/configPointSku/configpointsku.js?_${.now?long}"></script>
<style>
    .el-button.is-round {
        border-radius: 20px;
        padding: 2px 3px;

    }
    .el-button--info.is-plain {
        color: #909399;
        background: #f4f4f5;
        border-color: #d3d4d6;
        padding-top: 6px;
        padding-bottom: 6px;
    }
    .form-control.a.input-sm{
        width:80px;
    }
</style>
</body>
</html>